//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.mega.ycy;

import net.minecraft.client.Minecraft;
import net.minecraft.util.text.TextFormatting;

public class ColorPutter {
    public static final TextFormatting[] Rainbow;
    public static final TextFormatting[] C1;
    public static final TextFormatting[] C2;
    public static final TextFormatting[] P_;


    public ColorPutter() {
    }

    public static String Format(String Input, TextFormatting[] Style, double Delay, int Step) {
        StringBuilder Builder = new StringBuilder(Input.length() * 3);
        int Offset = (int)Math.floor((double)Minecraft.getSystemTime() / Delay) % Style.length;

        for(int i = 0; i < Input.length(); ++i) {
            char c = Input.charAt(i);
            int col = (i * Step + Style.length - Offset) % Style.length;
            Builder.append(Style[col]);
            Builder.append(c);
        }

        return Builder.toString();
    }

    public static String Set(String Input, TextFormatting[] Style, int Step) {
        StringBuilder Builder = new StringBuilder(Input.length() * 3);
        for(int i = 0; i < Input.length(); ++i) {
            char c = Input.charAt(i);
            int col = (i * Step + Style.length) % Style.length;
            Builder.append(Style[col]);
            Builder.append(c);
        }
        return Builder.toString();
    }

    public static String rainbow(String Input) {
        return Format(Input, Rainbow, 80.0D, 1);
    }

    public static String toCustom(String Input, TextFormatting[] textFormatting) {
        return Set(Input, textFormatting, 1);
    }

    public static String toCustomF(String Input, TextFormatting[] textFormatting, double speed) {
        return Format(Input, textFormatting, speed, 1);
    }

    public static String toCustom(String Input, TextFormatting textFormatting, double speed) {
        return Format(Input, new TextFormatting[]{textFormatting}, speed, 1);
    }

    static {
        Rainbow = new TextFormatting[]{TextFormatting.RED, TextFormatting.GOLD, TextFormatting.YELLOW, TextFormatting.GREEN, TextFormatting.AQUA, TextFormatting.BLUE, TextFormatting.LIGHT_PURPLE};
        C1 = new TextFormatting[]{TextFormatting.GOLD, TextFormatting.GOLD, TextFormatting.GOLD, TextFormatting.GOLD, TextFormatting.GOLD, TextFormatting.GOLD, TextFormatting.GOLD, TextFormatting.GOLD, TextFormatting.GOLD, TextFormatting.YELLOW, TextFormatting.WHITE, TextFormatting.WHITE, TextFormatting.YELLOW, TextFormatting.GOLD, TextFormatting.GOLD};
        C2 = new TextFormatting[]{TextFormatting.DARK_BLUE, TextFormatting.DARK_BLUE, TextFormatting.DARK_BLUE, TextFormatting.DARK_BLUE, TextFormatting.DARK_BLUE, TextFormatting.DARK_BLUE, TextFormatting.DARK_BLUE, TextFormatting.DARK_BLUE, TextFormatting.DARK_BLUE, TextFormatting.BLUE, TextFormatting.WHITE, TextFormatting.DARK_GRAY, TextFormatting.BLUE, TextFormatting.DARK_BLUE, TextFormatting.DARK_BLUE};
        P_ = new TextFormatting[]{TextFormatting.DARK_PURPLE, TextFormatting.ITALIC};
    }
}
